package com.cqcloud.platform.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import lombok.AllArgsConstructor;

/**
 * 系统基础信息--商品订单信息表管理模块
 *
 * @author weimeilayer@gmail.com ✨
 * @date 💓💕 2024-12-26 15:02:31 🐬🐇 💓💕
 */
@Controller
public class PayGoodsOrderController {
	
	/**
	 * 查询集合
	 * @return
	 */
	@Get(uri = "/list", produces = "application/json")
	public Object getPayGoodsOrderList() {
		List<Map<String, Object>> orders = new ArrayList<>();
	    
	    String[] statusDesc = {"待支付", "已支付", "已发货", "已完成", "已取消"};
	    
	    for (int i = 1; i <= 3; i++) {
	        Map<String, Object> order = new HashMap<>();
	        order.put("orderId", 1000 + i);
	        order.put("totalAmount", 500 * i);
	        order.put("status", i % 5);
	        order.put("statusDesc", statusDesc[i % 5]);
	        
	        List<Map<String, Object>> items = new ArrayList<>();
	        for (int j = 1; j <= 2; j++) {
	            Map<String, Object> item = new HashMap<>();
	            item.put("goodsId", 2000 + i * 10 + j);
	            item.put("goodsName", "测试商品" + (i * 10 + j));
	            item.put("price", 100 * j);
	            item.put("quantity", j);
	            items.add(item);
	        }
	        
	        order.put("items", items);
	        orders.add(order);
	    }
	    
	    return orders;
	}
}
